package com.orangelife.mobile.util;

import com.curry.log.behavior.BehaviorLog;
import com.curry.log.config.AppConfig;

public class BLog {

	public BehaviorLog bl;
	/*房屋维修*/
	public static final String REPAIR="repair";
	/*物业保修*/
	public static final String PREPAIR="property_repair";
	/*家政 */
	public static final String CLEAN="clean";
	/*定餐*/
	public static final String FOOD="food";
	/* 物业缴费*/
	public static final String PMFEE="pmfee";
	/* 团购 */
	public static final String GROUPON="groupon";
	/* 停车 管理 */
	public static final String PARKMNGM="parkMngm";
	/*停车卡管理*/
	public static final String PARKCARD="parkCard";
	public static final String SCORE="score";
	public static final String PARKING="parking";
	public static final int DETAIL_MER=1;
	public static final int DETAIL_ADVER=2;
	/*租赁*/
	public static final String RENT="rent";
	/*投诉*/
	public static final String COMPLAIN="complain";
	/*抵用券列表*/
	public static final String COUPON="coupon";
	/*地址*/
	public static final String ADDRESS="address";

	public static final String MESSAGE="message";
	/*发现*/
	public static final String DISCOVER="discover";
	/*周边*/
	public static final String NEARBY="nearby";
	/*首页*/
	public static final String HOME="home";
	/*我的*/
	public static final String MINE="mine";

	/*缴费订单*/
	public static final String GOODSORDER="goodsOrder";
	/*商品订单*/
	public static final String PMFEEORDER="pmfeeOrder";
	/*服务订单*/
	public static final String SERVICEORDER="serviceOrder";
	/*余额*/
	public static final String PURSE="purse";

	private String commID="";
	private static BLog bLog;
	public static BLog getInstance(){
		if(bLog==null){
			bLog = new BLog();
		}

		return bLog;
	}

	public void initBLog(AppConfig config){
		if(bl==null) {
			bl = new BehaviorLog(config);
		}
	}

	public void setCommID(String commID){
		this.commID=commID;
	}
	
	public void setMemberID(String memberID){
		if(bl==null)
			return;
		bl.setMemberID(memberID);
	}
	/**
	 *  appmod://orangelife/repair
		appmod://orangelife/clean
		appmod://orangelife/food
		appmod://orangelife/pmfee
		appmod://orangelife/parking
	 */
	public void click(String type){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_CLICK, "appmod://orangelife/" + type,commID);
	}


	public void click(String type,String id){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_CLICK, "appmod://orangelife/" + type+"/"+id, commID);
	}
	/**
	 * 无状态页停留
	 * @param type
	 */
	public void intAppmod(String type){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_DETAIL_IN, "appmod://orangelife/" + type, commID);
	}
	/**
	 * 无状态页停留
	 * @param type
	 */
	public void outAppmod(String type){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_DETAIL_OUT, "appmod://orangelife/" + type, commID);
	}

	/**
	 * 页面浏览
	 * @param type
	 * @param id
	 */
	public void intDetail(String type,String id){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_DETAIL_IN,type+ "://"+id,commID);
	}
	/**
	 * 页面浏览
	 * @param type
	 * @param id
	 */
	public void outDetail(String type,String id){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_DETAIL_OUT,type+ "://"+id,commID);
	}
	/**
	 * 商家 浏览IN
	 * @param id
	 */
	public void inMerDetail(String id){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_DETAIL_IN, "mer://"+id,commID);
	}

	public void clickAdver(String id,int num){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_CLICK, "adver://"+num+"/"+id,commID);
	}
	/**
	 * 商家 浏览OUT
	 * @param id
	 */
	public void outMerDetail(String id){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_DETAIL_OUT, "mer://"+id, commID);
	}
	/**
	 * 广告
	 * @param id
	 * @param num
	 */
	public void inAdverDetail(String id,int num){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_DETAIL_IN, "adver://"+num+"/"+id, commID);
	}
	/**
	 * 广告
	 * @param id
	 * @param num
	 */
	public void outAdverDetail(String id,int num){
		if(bl==null)
			return;
		bl.setBehavior(BehaviorLog.ACT_DETAIL_OUT, "adver://"+num+"/"+id,commID);
	}


	/**
	 * 上传日志
	 */

	public  void upload() {
		if (bl != null) {
//			bl.upload();
		}
	}



}
